/*
 * acooly.cn Inc.
 * Copyright (c) 2017 All Rights Reserved.
 * create by ouwen
 * date:2017-09-20
 */
package com.yiji.fintech.musfinance.service.impl;

import com.acooly.core.common.service.EntityServiceImpl;
import com.yiji.fintech.musfinance.common.exception.DBException;
import com.yiji.fintech.musfinance.dao.InstBankDao;
import com.yiji.fintech.musfinance.entity.InstBank;
import com.yiji.fintech.musfinance.service.InstBankService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * center_inst_bank Service实现
 *
 * Date: 2017-09-20 13:40:23
 *
 * @author ouwen
 *
 */
@Service("instBankService")
public class InstBankServiceImpl extends EntityServiceImpl<InstBank, InstBankDao> implements InstBankService {
    @Autowired
    private JdbcTemplate jdbcTemplate;

    @Override
    public List<Map<String,Object>> getAllInstBank(){
        try {
            return jdbcTemplate.queryForList("select INST_BANK_ID,INST_BANK_NAME,UNION_BANK_NO,ZH_ABBREVIATION from center_inst_bank");
        } catch (Exception e) {
            throw new DBException(e.getMessage());
        }
    }

    @Override
    public InstBank unique(String bankId) {
        return getEntityDao().findUniqu("EQ_instBankId",bankId);
    }
}
